The heap property defines the value relationship between a parent and its children.

  • Max-Heap: The value of every node is greater than or equal to the values of its children. The largest element is always at the root.
  • Min-Heap: The value of every node is less than or equal to the values of its children. The smallest element is always at the root.

Property Rules

For a Max-Heap: $ \text{Parent} \ge \text{Children} $

For a Min-Heap: $ \text{Parent} \le \text{Children} $

Max-Heap

50 19 36

Min-Heap

5 19 36